package com.zhongkun.datahome.service.repository;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhongkun.datahome.service.constant.AppointmentStatusEnum;
import com.zhongkun.datahome.service.domain.AppointmentRecord;
import com.zhongkun.datahome.service.mapper.AppointmentRecordMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: huangjie
 * @Date: 2025/4/14 17:15
 * @Desc
 */
@Repository
public class AppointmentRecordRepository extends ServiceImpl<AppointmentRecordMapper, AppointmentRecord> {

    public AppointmentRecord queryAppointmentRecord(Long customerHouseId, Long appointmentId) {
        return lambdaQuery().eq(AppointmentRecord::getCustomerHouseId, customerHouseId)
                .eq(AppointmentRecord::getAppointmentId, appointmentId)
                .eq(AppointmentRecord::getAppointmentStatus, AppointmentStatusEnum.VALID.getCode())
                .one();
    }

    public List<AppointmentRecord> queryByAppointmentTimeSlotIdList(List<Long> appointmentTimeSlotIdList) {
        return lambdaQuery().in(AppointmentRecord::getTimeSlotId, appointmentTimeSlotIdList)
                .eq(AppointmentRecord::getAppointmentStatus, AppointmentStatusEnum.VALID.getCode())
                .list();
    }
}
